import { createRouter, createWebHistory } from 'vue-router'
// import HomeView from '../views/HomeView.vue'
import login from '../views/Login.vue'
import page from './pages'
import refresh from '@/views/RefreshIndirect.vue'

const routes = [
  {
    path: '/',
    redirect: '/index/indexabout',
    // redirect: '/login',
    // redirect: '/text',
    meta: {
      title: "indexabout"
    }
  },
  {
    path: '/index',
    name: 'index',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/Index.vue'),
    redirect: '/index/indexabout',
     meta: {
      title: "indexabout"
    },
    children: [
      {
        // path: 'refresh/:path(.*)',//:path(.*)搜索的内容----*(一个或者多个)
        path: 'refresh/:path(.*)',//:path(.*)搜索的内容----*(一个或者多个)
        name: 'refresh-chlid',
        component: refresh,
      },
      {
        path: 'indexabout',
        name: 'indexabout',
        component: () => import(/* webpackChunkName: "about" */ '../views/IndexAboutS.vue'),
        meta: {
          title: "indexabout"
        }
      },
      {
        path: 'myselfinfo',
        name: 'myselfinfo',
        component: () => import('@/views/myself/MySelfinfo.vue'),
        meta: {
          title: "myselfinfo"
        }
      }, {
        path: "mypassword",
        name: "mypassword",
        component: () => import('@/views/myself/PassWord.vue'),
        meta: {
          title: "mypassword"
        }
      },
      ...page,

    ]
  },
  {
    path: '/login',
    name: 'login',
    component: login
  },
  {
    path: '/about',
    name: 'about',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
  },
  {
    path: '/404',
    name: '404',
    component: () => import(/* webpackChunkName: "about" */ '../views/404.vue')
  },
  // {
  //   path: '/text',
  //   name: 'text',
  //   component: () => import(/* webpackChunkName: "about" */ '../views/Text.vue')
  // },
  {
    path: '/:path(.*)+',
    name: 'gnfd',
    redirect: '/404'
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
